//
//  GLKTableViewController.m
//  KTools
//
//  Created by zhiyong.kuang on 2017/9/28.
//  Copyright © 2017年 zhiyong.kuang. All rights reserved.
//

#import "GLKTableViewController.h"
#import <Masonry/Masonry.h>
#import "GLCustomCell.h"
#import "GLPickerView.h"
#import "GLFormOptionSelectCell.h"
#import "GLFormRecordCell.h"
#import "GLFormRecordFooterCell.h"
#import "GLFormTextViewInputCell.h"
#import "GLFormFollowCell.h"
#import "UIViewController+GLForm.h"


@interface GLKTableViewController ()
@property(nonatomic,strong)NSArray* hideRows;
@end

@implementation GLKTableViewController

-(void)viewDidLoad{
    
    [super viewDidLoad];
    
    GLForm* form = [self configForm];
    
    __weak typeof(self) weakSelf = self;
    form.formClicked = ^(GLFormRow *row, id sender, BOOL isSub, NSString *subTag) {
        if (isSub) {
            NSLog(@"eventClicked--->%@---%@",sender,subTag);
            
            NSIndexPath* indexPath = [weakSelf.gl_form indexPathForFormRow:row];
            if ([row.tag isEqualToString:@"rowFooter"] && [subTag isEqualToString:@"footerCell"]){
                
                if ([row.value boolValue]) {//需要展开
                    
                    NSMutableArray* showData = [NSMutableArray arrayWithCapacity:0];
                    for (NSInteger index = 1;index < 22;index++) {
                        NSString* process = @"不差钱，请快点交车";
                        GLFormRow* rowRecord = [GLFormRow formRowByRegisterClass:[GLFormRecordCell class] withTag:@"rowRecord"];
                        rowRecord.rowHeight = [GLFormRecordCell cellHeightByText:process];
                        
                        [rowRecord addConfigValue:@"2017-09-24" forKeyPath:@"timeLab.text"];
                        [rowRecord addConfigValue:process forKeyPath:@"text"];
                        [showData addObject:rowRecord];
                    }
                    GLFormSection* section = [weakSelf.gl_form formSectionAtIndex:indexPath.section];
                    [section insertFormRows:showData atIndex:indexPath.row];
                    
                    [self gl_reloadSection:indexPath.section];
                }else{//需要关闭
                    
                    GLFormSection* section = [weakSelf.gl_form formSectionAtIndex:indexPath.section];
                    
                    NSArray* hideRows = [section formRowsWithTag:@"rowRecord"];
                    [section removeFormRowsInArray:hideRows];
                    [weakSelf gl_reloadSection:indexPath.section];
                }
            }
        }else{
            
            if (self.index == 0) {
                NSIndexPath* indexPath = [self.gl_form indexPathForFormRow:row];
                GLKTableViewController* ctl = [[GLKTableViewController alloc]init];
                ctl.index = indexPath.row+1;
                [self.navigationController pushViewController:ctl animated:YES];
            }
            else if (self.index == 3){
                
            }
            
        }
    };
    
    if (self.index == 0) {
        form.showCorner = NO;
    }else{
        form.showCorner = YES;
    }
    [self gl_registerForm:form];
    
    UIBarButtonItem* item = [[UIBarButtonItem alloc]initWithTitle:@"保存" style:UIBarButtonItemStylePlain target:self action:@selector(save)];
    self.navigationItem.rightBarButtonItem = item;
    
}
-(void)dealloc{
    NSLog(@"");
}
-(void)save{
    GLFormError* valueError = [self.gl_form validateFormValues];
    if (valueError) {
        NSLog(@"tag:%@  errMsg:%@  code:%ld",valueError.tag,valueError.domain,valueError.code);
        return;
    }
    
    NSDictionary* formvalues = [self.gl_form formValues];
    NSLog(@"formvalues:%@",formvalues);
}


-(void)formRow:(GLFormRow*)row valueChanged:(id)newValue{
    NSLog(@"valueChanged--->%@",newValue);
}


-(GLForm*)configForm{
    switch (self.index) {
        case 0:
        {
            return [self form0];
            break;
        }
        case 1:
        {
            return [self form1];
            break;
        }
        case 2:
        {
            return [self form2];
            break;
        }
        case 3:
        {
            return [self form3];
            break;
        }
        case 4:
        {
            return [self form4];
            break;
        }
        case 5:
        {
            return [self form5];
            break;
        }
        default:
            break;
    }
    
    return nil;
}


-(GLForm*)form0{
    GLForm* form = [GLForm formWithTag:@"form"];
    
    GLFormSection* section = [GLFormSection formSectionWithTag:@""];
    GLFormRow* row1 = [GLFormRow formRowByComponentKeys:@[GLCustomCellText,GLCustomCellArrow] withTag:@"111"];
    [row1 addConfigValue:@"重复表单1" componentKey:GLCustomCellText forKeyPath:nil];

    
    GLFormRow* row3 = [GLFormRow formRowByComponentKeys:@[GLCustomCellText,GLCustomCellArrow] withTag:@"111"];
    [row3 addConfigValue:@"接客建档" componentKey:GLCustomCellText forKeyPath:nil];
    [row3 addConfigValue:[UIColor redColor] componentKey:GLCustomCellText forKeyPath:@"textColor"];
    
    GLFormRow* row4 = [GLFormRow formRowByComponentKeys:@[GLCustomCellText,GLCustomCellArrow] withTag:@"111"];
    [row4 addConfigValue:@"客户信息" componentKey:GLCustomCellText forKeyPath:nil];
    
    GLFormRow* row5 = [GLFormRow formRowByComponentKeys:@[GLCustomCellText,GLCustomCellArrow] withTag:@"111"];
    [row5 addConfigValue:@"接客建档2" componentKey:GLCustomCellText forKeyPath:nil];
    [row5 addConfigValue:[UIColor blueColor] componentKey:GLCustomCellText forKeyPath:@"textColor"];
    
    GLFormRow* row6 = [GLFormRow formRowByComponentKeys:@[GLCustomCellText,GLCustomCellArrow] withTag:@"111"];
    [row6 addConfigValue:@"客户信息2" componentKey:GLCustomCellText forKeyPath:nil];
    
    [section addFormRow:row1];
    [section addFormRow:row3];
    [section addFormRow:row4];
    [section addFormRow:row5];
    [section addFormRow:row6];
    [form addFormSection:section];
    
    return form;
    
}

-(GLForm*)form1{
    GLForm* form = [GLForm formWithTag:@"form"];
    
    for (int i = 0;i<66;i++) {
        GLFormSection* section = [GLFormSection formSectionWithTag:@""];
        GLFormRow* row1 = [GLFormRow formRowByComponentKeys:@[GLCustomCellText,GLCustomCellButton,GLCustomCellCatpionText,GLCustomCellBadge] withTag:@"111"];
        [row1 addConfigValuesByDictionary:@{GLCustomCellText:[NSString stringWithFormat:@"匡志勇%d",i],
                                            GLCustomCellButton:@"icon",
                                            GLCustomCellBadge:@"交车日期未维护",
                                            }];
        
        
        GLFormRow* row2 = [GLFormRow formRowByComponentKeys:@[GLCustomCellText,GLCustomCellCatpionText] withTag:@"222"];
        [row2 addConfigValuesByDictionary:@{GLCustomCellText:@"车型",
                                            GLCustomCellCatpionText:@"",
                                            }];
        
        GLFormRow* row3 = [GLFormRow formRowByComponentKeys:@[GLCustomCellText,GLCustomCellCatpionText] withTag:@"222"];
        [row3 addConfigValuesByDictionary:@{GLCustomCellText:@"颜色",
                                            GLCustomCellCatpionText:@"摩卡红",
                                            }];
        
        GLFormRow* row4 = [GLFormRow formRowByComponentKeys:@[GLCustomCellText,GLCustomCellButton] withTag:@"222"];
        [row4 addConfigValuesByDictionary:@{GLCustomCellText:@"销售顾问",
                                            GLCustomCellCatpionText:@"",
                                            }];
        
        [section addFormRow:row1];
        [section addFormRow:row2];
        [section addFormRow:row3];
        [section addFormRow:row4];
        [form addFormSection:section];
    }
    
    return form;
    
}

-(GLForm*)form2{
    GLForm* form = [GLForm formWithTag:@"form"];
    
    GLFormSection* section1 = [GLFormSection formSectionWithTag:@""];
    GLFormRow* row1 = [GLFormRow formRowByComponentKeys:@[GLCustomCellText,GLCustomCellInput,GLCustomCellButton3] withTag:@"userName"];
    [row1 addConfigValuesByDictionary:@{GLCustomCellText:@"客户名称",
                                        GLCustomCellButton3:@"头",
                                        }];
    row1.valueKey = GLCustomCellInput;
    row1.value = @"匡志勇";
    row1.isRequried = YES;
    row1.validateValueBlock = ^NSString *(GLFormRow *row, id value) {
        NSString* strValue = (NSString*)value;
        if (strValue.length < 2) {
            return @"名称太短了";
        }
        return nil;
    };
    
    GLFormRow* row2 = [GLFormRow formRowByComponentKeys:@[GLCustomCellText,GLCustomCellInput,GLCustomCellButton3] withTag:@"userPhone"];
    [row2 addConfigValuesByDictionary:@{GLCustomCellText:@"客户手机",
                                        GLCustomCellButton3:@"查",
                                        }];
    row2.valueKey = GLCustomCellInput;
    row2.value = @"17006423567";
    
    GLFormRow* row3 = [GLFormRow formRowByComponentKeys:@[GLCustomCellText,GLCustomCellRightNoEditInput,GLCustomCellArrow] withTag:@"sex"];
    [row3 addConfigValuesByDictionary:@{GLCustomCellText:@"性别",
                                        }];
    row3.isRequried = YES;
    row3.valueKey = GLCustomCellRightNoEditInput;
    row3.action = GLFormRowActionPicker;
    row3.options = @[@"男",@"女"];
    
    GLFormRow* row4 = [GLFormRow formRowByComponentKeys:@[GLCustomCellText,GLCustomCellRightNoEditInput,GLCustomCellArrow] withTag:@"userFrom"];
    [row4 addConfigValuesByDictionary:@{GLCustomCellText:@"客户来源",
                                        }];
    row4.valueKey = GLCustomCellRightNoEditInput;
    row4.action = GLFormRowActionPushOption;
    row4.isRequried = YES;
    row4.options = @[@"APP",@"到店",@"不知道哪来的"];
    
    GLFormRow* row5 = [GLFormRow formRowByComponentKeys:@[GLCustomCellText,GLCustomCellRightNoEditInput,GLCustomCellArrow] withTag:@"userLevel"];
    [row5 addConfigValuesByDictionary:@{GLCustomCellText:@"客户级别",
                                        }];
    row5.isRequried = YES;
    row5.valueKey = GLCustomCellRightNoEditInput;
    row5.action = GLFormRowActionPushInput;
//    row5.options = @[@"1",@"2",@"3",@"4",@"5",@"6",@"7"];
    
    GLFormRow* row6 = [GLFormRow formRowByComponentKeys:@[GLCustomCellText,GLCustomCellRightNoEditInput,GLCustomCellArrow] withTag:@"address"];
    [row6 addConfigValuesByDictionary:@{GLCustomCellText:@"所在地区",
                                        }];
    row6.valueKey = GLCustomCellRightNoEditInput;
    row6.action = GLFormRowActionPushInput;
    row6.value = @"浙江省杭州市辖区";
    
    GLFormRow* row7 = [GLFormRow formRowByComponentKeys:@[GLCustomCellText,GLCustomCellInput] withTag:@"detailAddress"];
    [row7 addConfigValuesByDictionary:@{GLCustomCellText:@"详细地址",
                                        }];
    row7.valueKey = GLCustomCellInput;
    
    
    [section1 addFormRow:row1];
    [section1 addFormRow:row2];
    [section1 addFormRow:row3];
    [section1 addFormRow:row4];
    [section1 addFormRow:row5];
    [section1 addFormRow:row6];
    [section1 addFormRow:row7];
    [form addFormSection:section1];
    
    
    GLFormSection* section2 = [GLFormSection formSectionWithTag:@""];
    GLFormRow* row21 = [GLFormRow formRowByComponentKeys:@[GLCustomCellText,GLCustomCellRightNoEditInput,GLCustomCellArrow] withTag:@"carType"];
    [row21 addConfigValuesByDictionary:@{GLCustomCellText:@"意向车型",
                                         }];
    row21.valueKey = GLCustomCellRightNoEditInput;
    row21.action = GLFormRowActionPicker;
    row21.options = @[@"吉利博瑞",@"帝豪",@"远景",@"博越"];
    row21.isRequried = YES;
    
    
    GLFormRow* row22 = [GLFormRow formRowByComponentKeys:@[GLCustomCellText,GLCustomCellRightNoEditInput,GLCustomCellArrow] withTag:@"carColor"];
    [row22 addConfigValuesByDictionary:@{GLCustomCellText:@"车辆颜色",
                                         }];
    row22.valueKey = GLCustomCellRightNoEditInput;
    row22.action = GLFormRowActionPicker;
    row22.options = @[@"红",@"橙",@"黄",@"绿",@"青",@"蓝"];
    
    GLFormRow* row23 = [GLFormRow formRowByComponentKeys:@[GLCustomCellText,GLCustomCellRightNoEditInput,GLCustomCellArrow] withTag:@"carAbout"];
    [row23 addConfigValuesByDictionary:@{GLCustomCellText:@"购车关注",
                                         }];
    row23.valueKey = GLCustomCellRightNoEditInput;
    row23.action = GLFormRowActionPicker;
    row23.options = @[@"油耗",@"外观",@"价格",@"品牌",@"性能"];
    
    GLFormRow* row24 = [GLFormRow formRowByComponentKeys:@[GLCustomCellText,GLCustomCellSwitch] withTag:@"payAll"];
    [row24 addConfigValuesByDictionary:@{GLCustomCellText:@"是否全款",
                                         }];
    row24.valueKey = GLCustomCellSwitch;
    row24.value = [NSNumber numberWithBool:YES];
    
    GLFormRow* row25 = [GLFormRow formRowByRegisterClass:[GLFormOptionSelectCell class] withTag:@"carAttention"];
    row25.rowHeight = 110;
    
    [section2 addFormRow:row21];
    [section2 addFormRow:row22];
    [section2 addFormRow:row23];
    [section2 addFormRow:row24];
    [section2 addFormRow:row25];
    [form addFormSection:section2];
    
    
    GLFormSection* section3 = [GLFormSection formSectionWithTag:@""];
    GLFormRow* row31 = [GLFormRow formRowByComponentKeys:@[GLCustomCellText,GLCustomCellTextView] withTag:@"firstAccpet"];
    [row31 addConfigValuesByDictionary:@{GLCustomCellText:@"初次接待",
                                         }];
    row31.rowHeight = 120;
    row31.valueKey = GLCustomCellTextView;
    
    [section3 addFormRow:row31];
    
    [form addFormSection:section3];
    return form;
    
}


-(GLForm*)form3{
    GLForm* form = [GLForm formWithTag:@"form"];
    
    
    //section1
    GLFormSection* section1 = [GLFormSection formSectionWithTag:@""];
    //客户名称
    GLFormRow* row11 = [GLFormRow formRowByComponentKeys:@[GLCustomCellText,GLCustomCellCatpionText] withTag:@"userName"];
    [row11 addConfigValuesByDictionary:@{GLCustomCellText:@"匡志勇"}];
    
    
    
    //购买车型
    GLFormRow* row12 = [GLFormRow formRowByComponentKeys:@[GLCustomCellGrayText,GLCustomCellText2,GLCustomCellCatpionText] withTag:@"carSeries"];
    [row12 addConfigValuesByDictionary:@{GLCustomCellGrayText:@"购买车型",
                                         GLCustomCellText2:@"博瑞"}];
    
    
    
    //车辆颜色
    GLFormRow* row14 = [GLFormRow formRowByComponentKeys:@[GLCustomCellGrayText,GLCustomCellText2,GLCustomCellCatpionText] withTag:@"carColor"];
    [row14 addConfigValuesByDictionary:@{GLCustomCellGrayText:@"车辆颜色",
                                         GLCustomCellText2:@"土豪金"}];
    
    
    [section1 addFormRow:row11];
    [section1 addFormRow:row12];
    
    [section1 addFormRow:row14];
    
    [form addFormSection:section1];
    
    GLFormSection* section2 = [GLFormSection formSectionWithTag:@""];
    //跟进记录
    NSString* planInquiryDate = [NSString stringWithFormat:@"下次回访时间 %@",@"2017-10-22"];
    GLFormRow* row21 = [GLFormRow formRowByComponentKeys:@[GLCustomCellText,GLCustomCellCatpionText] withTag:@"followRecord"];
    [row21 addConfigValuesByDictionary:@{GLCustomCellText:@"过程记录",
                                         GLCustomCellCatpionText:planInquiryDate}];
    [section2 addFormRow:row21];
    
    for (int i = 0;i<22;i++) {
        
        GLFormRow* followRow = [GLFormRow formRowByRegisterClass:[GLFormRecordCell class] withTag:@"followRecordItem"];
        [followRow addConfigValue:@"2017-10-22" forKeyPath:@"timeLab.text"];
        [followRow addConfigValue:@"这个客户很拽这个客户很拽这个客户很拽这个客户很拽这个客户很拽这个客户很拽" forKeyPath:@"text"];
        if (i == 0) {
            [followRow addConfigValue:[NSNumber numberWithBool:YES] forKeyPath:@"isCurRecord"];
        }else{
            [followRow addConfigValue:[NSNumber numberWithBool:NO] forKeyPath:@"isCurRecord"];
        }
        followRow.rowHeight = [GLFormRecordCell cellHeightByText:@"这个客户很拽这个客户很拽这个客户很拽这个客户很拽这个客户很拽这个客户很拽"];
        [section2 addFormRow:followRow];
        
        
        
    }
    [form addFormSection:section2];
    
    
    return form;
    
    
}


-(GLForm*)form4{
   
    GLForm* form = [GLForm formWithTag:@"form"];
    //section1
    GLFormSection* section1 = [GLFormSection formSectionWithTag:@""];
    
    //客户名称
    GLFormRow* row1 = [GLFormRow formRowByComponentKeys:@[GLCustomCellGrayText,GLCustomCellInput,GLCustomCellButton3] withTag:@"userName"];
    [row1 addConfigValuesByDictionary:@{GLCustomCellGrayText:@"客户名称",
                                        GLCustomCellButton3:[UIImage imageNamed:@"icon-通讯录"],
                                        }];
    row1.valueKey = GLCustomCellInput;
    row1.isRequried = YES;
    row1.requriedMsg = @"请输入用户名称!";
    
    //客户手机
    GLFormRow* row2 = [GLFormRow formRowByComponentKeys:@[GLCustomCellGrayText,GLCustomCellInput,GLCustomCellButton3] withTag:@"userPhone"];
    [row2 addConfigValuesByDictionary:@{GLCustomCellGrayText:@"客户手机",
                                        GLCustomCellButton3:[UIImage imageNamed:@"icon-search"],
                                        }];
    row2.valueKey = GLCustomCellInput;
    row2.isRequried = YES;
    row2.requriedMsg = @"请输入正确手机号";
    row2.validateValueBlock = ^NSString *(GLFormRow *row, id value) {
        NSString* strValue = (NSString*)value;
        if (!strValue || [strValue isEqualToString:@""] || ![[strValue substringToIndex:1] isEqualToString:@"1"] || [strValue length] != 11){
            return @"请输入正确手机号";
        }
        return nil;
    };
    
    //性别
    GLFormRow* row3 = [GLFormRow formRowByComponentKeys:@[GLCustomCellGrayText,GLCustomCellLeftNoEditInput,GLCustomCellArrow] withTag:@"sex"];
    [row3 addConfigValuesByDictionary:@{GLCustomCellGrayText:@"性别",
                                        }];
    [row3 addConfigValue:[NSNumber numberWithInteger:4] componentKey:GLCustomCellGrayText forKeyPath:@"limitWordNumber"];
    row3.isRequried = YES;
    row3.requriedMsg = @"请选择性别";
    row3.valueKey = GLCustomCellLeftNoEditInput;
    
    //客户来源
    GLFormRow* row4 = [GLFormRow formRowByComponentKeys:@[GLCustomCellGrayText,GLCustomCellLeftNoEditInput,GLCustomCellArrow] withTag:@"userFrom"];
    [row4 addConfigValuesByDictionary:@{GLCustomCellGrayText:@"客户来源",
                                        }];
    row4.valueKey = GLCustomCellLeftNoEditInput;
    row4.isRequried = YES;
    row4.requriedMsg = @"请选择客户来源";
    
    //客户级别
    GLFormRow* row5 = [GLFormRow formRowByComponentKeys:@[GLCustomCellGrayText,GLCustomCellLeftNoEditInput,GLCustomCellArrow] withTag:@"userLevel"];
    [row5 addConfigValuesByDictionary:@{GLCustomCellGrayText:@"客户级别",
                                        }];
    
    row5.valueKey = GLCustomCellLeftNoEditInput;
    row5.isRequried = YES;
    row5.requriedMsg = @"请选择客户级别";
    
    
    //所在地区
    GLFormRow* row6 = [GLFormRow formRowByComponentKeys:@[GLCustomCellGrayText,GLCustomCellLeftNoEditInput,GLCustomCellArrow] withTag:@"address"];
    [row6 addConfigValuesByDictionary:@{GLCustomCellGrayText:@"所在地区",
                                        }];
    row6.valueKey = GLCustomCellLeftNoEditInput;
    
    //详细地址
    GLFormRow* row7 = [GLFormRow formRowByComponentKeys:@[GLCustomCellGrayText,GLCustomCellInput] withTag:@"detailAddress"];
    [row7 addConfigValuesByDictionary:@{GLCustomCellGrayText:@"详细地址",
                                        }];
    row7.valueKey = GLCustomCellInput;
    
    
    [section1 addFormRow:row1];
    [section1 addFormRow:row2];
    [section1 addFormRow:row3];
    [section1 addFormRow:row4];
    [section1 addFormRow:row5];
    [section1 addFormRow:row6];
    [section1 addFormRow:row7];
    [form addFormSection:section1];
    
    //section2
    GLFormSection* section2 = [GLFormSection formSectionWithTag:@""];
    
    //意向车型
    GLFormRow* row21 = [GLFormRow formRowByComponentKeys:@[GLCustomCellGrayText,GLCustomCellLeftNoEditInput,GLCustomCellArrow] withTag:@"carType"];
    [row21 addConfigValuesByDictionary:@{GLCustomCellGrayText:@"意向车型",
                                         }];
    row21.valueKey = GLCustomCellLeftNoEditInput;
    row21.isRequried = YES;
    row21.requriedMsg = @"请选择意向车型";
    
    
    //车辆颜色
    GLFormRow* row22 = [GLFormRow formRowByComponentKeys:@[GLCustomCellGrayText,GLCustomCellLeftNoEditInput,GLCustomCellArrow] withTag:@"carColor"];
    [row22 addConfigValuesByDictionary:@{GLCustomCellGrayText:@"车辆颜色",
                                         }];
    row22.valueKey = GLCustomCellLeftNoEditInput;
    
    //购车关注
    GLFormRow* row23 = [GLFormRow formRowByRegisterClass:[GLFormOptionSelectCell class] withTag:@"carAttention"];
    [row23 addConfigValue:@"购车关注" forKeyPath:@"titleLab.text"];
    row23.rowHeight = 110;
    
    
    [section2 addFormRow:row21];
    [section2 addFormRow:row22];
    [section2 addFormRow:row23];
    [form addFormSection:section2];
    
    
    //    GLFormTextViewInputCell
    GLFormSection* section3 = [GLFormSection formSectionWithTag:@""];
    GLFormRow* row31 = [GLFormRow formRowByRegisterClass:[GLFormTextViewInputCell class] withTag:@"firstAccpet"];
    [row31 addConfigValue:@"初次接待" forKeyPath:@"titleLab.text"];
    row31.rowHeight = 120;
    [section3 addFormRow:row31];
    
    [form addFormSection:section3];
    return form;
    
}



-(GLForm*)form5{
    
    GLForm* form = [GLForm formWithTag:@"form"];
    UIView* tableHeader = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 60)];
    tableHeader.backgroundColor = [ UIColor orangeColor];
    form.formHeaderView = tableHeader;
    
    //section1
    GLFormSection* section1 = [GLFormSection formSectionWithTag:@""];
    
    
    NSString *name = [NSString stringWithFormat:@"刘德华(H)"];
    
    
    NSString *salesConsultantName = @"张学友";
    if (!salesConsultantName) {
        salesConsultantName = [NSString stringWithFormat:@"销售顾问:%@",salesConsultantName];
    }else {
        salesConsultantName = [NSString stringWithFormat:@"销售顾问:%@",@"无"];
    }
    //客户名称
    GLFormRow* row11 = [GLFormRow formRowByComponentKeys:@[GLCustomCellText,GLCustomCellText2] withTag:@"userName"];
    [row11 addConfigValuesByDictionary:@{GLCustomCellText:name,GLCustomCellText2:salesConsultantName}];
    
    
    
    //客户手机
    GLFormRow* row12 = [GLFormRow formRowByComponentKeys:@[GLCustomCellGrayText,GLCustomCellText2,GLCustomCellCatpionText,GLCustomCellButton3,GLCustomCellButton3] withTag:@"mobileNo"];
    [row12 addConfigValuesByDictionary:@{GLCustomCellGrayText:@"客户手机",
                                         GLCustomCellText2:@"13888888888",
                                         GLCustomCellButton3:[UIImage imageNamed:@"icon-电话"],
                                         GLCustomCellButton3:[UIImage imageNamed:@"icon-短信"],
                                         }];
    
    //客户来源
    GLFormRow* row13 = [GLFormRow formRowByComponentKeys:@[GLCustomCellGrayText,GLCustomCellText2,GLCustomCellCatpionText] withTag:@"customerFrom"];
    [row13 addConfigValuesByDictionary:@{GLCustomCellGrayText:@"客户来源",
                                         GLCustomCellText2:@"自己来的",
                                         }];
    //所在地区
    GLFormRow* row14 = [GLFormRow formRowByComponentKeys:@[GLCustomCellGrayText,GLCustomCellText2,GLCustomCellCatpionText] withTag:@"curCity"];
    [row14 addConfigValuesByDictionary:@{GLCustomCellGrayText:@"所在地区",
                                         GLCustomCellText2:@"北京市传媒大学",
                                         }];
    //详细地址
    GLFormRow* row15 = [GLFormRow formRowByComponentKeys:@[GLCustomCellGrayText,GLCustomCellText2,GLCustomCellCatpionText] withTag:@"address"];
    [row15 addConfigValuesByDictionary:@{GLCustomCellGrayText:@"详细地址",
                                         GLCustomCellText2:@"5号宿舍",
                                         }];
    
    [section1 addFormRow:row11];
    [section1 addFormRow:row12];
    [section1 addFormRow:row13];
    [section1 addFormRow:row14];
    [section1 addFormRow:row15];
    
    //section2
    GLFormSection* section2 = [GLFormSection formSectionWithTag:@""];
    
    //意向车系
    GLFormRow* row21 = [GLFormRow formRowByComponentKeys:@[GLCustomCellGrayText,GLCustomCellText2,GLCustomCellCatpionText,GLCustomCellButton3,GLCustomCellButton3] withTag:@"purposeSeries"];
    [row21 addConfigValuesByDictionary:@{GLCustomCellGrayText:@"意向车系",
                                         GLCustomCellText2:@"博瑞",
                                         }];
    
    //意向车型
    GLFormRow* row22 = [GLFormRow formRowByComponentKeys:@[GLCustomCellGrayText,GLCustomCellText2,GLCustomCellCatpionText,GLCustomCellButton3,GLCustomCellButton3] withTag:@"purposeModel"];
    [row22 addConfigValuesByDictionary:@{GLCustomCellGrayText:@"意向车型",
                                         GLCustomCellText2:@"非机动车",
                                         }];
    
    //车辆颜色
    GLFormRow* row23 = [GLFormRow formRowByComponentKeys:@[GLCustomCellGrayText,GLCustomCellText2,GLCustomCellCatpionText] withTag:@"purposeColor"];
    [row23 addConfigValuesByDictionary:@{GLCustomCellGrayText:@"车辆颜色",
                                         GLCustomCellText2:@"土豪色",
                                         }];
    //购车关注
    GLFormRow* row24 = [GLFormRow formRowByComponentKeys:@[GLCustomCellGrayText,GLCustomCellText2,GLCustomCellCatpionText] withTag:@"focusName"];
    [row24 addConfigValuesByDictionary:@{GLCustomCellGrayText:@"购车关注",
                                         GLCustomCellText2:@"不关注，不差线",
                                         }];
    //初次接待
    GLFormRow* row25 = [GLFormRow formRowByRegisterClass:[GLFormFollowCell class] withTag:@"lastRecord"];
    [row25 addConfigValue:@"初次接待" forKeyPath:@"title"];
    [row25 addConfigValue:[NSNumber numberWithBool:YES] forKeyPath:@"buttonHide"];
    [row25 addConfigValue:@"有钱，任性" forKeyPath:@"record"];
    row25.rowHeight = [GLFormFollowCell cellHeightByText:@"有钱，任性" hideButton:YES];
    
    [section2 addFormRow:row21];
    [section2 addFormRow:row22];
    [section2 addFormRow:row23];
    [section2 addFormRow:row24];
    [section2 addFormRow:row25];
    
    
    
    //section3
    GLFormSection* section3 = [GLFormSection formSectionWithTag:@""];
    
    GLFormRow* rowCurRecord = [GLFormRow formRowByRegisterClass:[GLFormRecordCell class] withTag:@"rowCurRecord"];
    
    
    
    [rowCurRecord addConfigValue:@"2017-10-22" forKeyPath:@"timeLab.text"];
    [rowCurRecord addConfigValue:@"不差钱" forKeyPath:@"text"];
    rowCurRecord.rowHeight = [GLFormRecordCell cellHeightByText:@"不差钱"];
    [section3 addFormRow:rowCurRecord];
    
    
    GLFormRow* rowFooter = [GLFormRow formRowByRegisterClass:[GLFormRecordFooterCell class] withTag:@"rowFooter"];
    rowFooter.value = [NSNumber numberWithBool:NO];
    
    rowFooter.rowHeight = 40;
    [section3 addFormRow:rowFooter];
    
    [form addFormSection:section1];
    [form addFormSection:section2];
    [form addFormSection:section3];
    
    return form;
    
}


-(BOOL)showCornerForm{
    if (self.index == 0) {
        return NO;
    }
    return YES;
}

@end
